package by.kniazhych.core.server.common {
	
	/**
	 * ...
	 * @author Boutylin Mikhail
	 */
	
		import by.vaukalak.core.commands.CommandDispatcher;
	

	
	public class BaseServerCommandDispatcher extends CommandDispatcher{
		
		private const _actionCounter:ActionCounter = new ActionCounter();;
		
		public function BaseServerCommandDispatcher() {
			super();
		}
		
		//--------------------------------------------------------------------------
		//
		//  PUBLIC METHODS
		//
		//--------------------------------------------------------------------------
		
		public function dispatchServerCommand(commandName:String, flag:String, args:Array):void {
			super.dispatchCommand(new ServerActionCommand(commandName, _actionCounter.nextCount, flag, args));
		}
		
	}

}

//--------------------------------------------------------------------------
//
//  INNER DEFINITIONS
//
//--------------------------------------------------------------------------

class ActionCounter {
	
	private var _currentCount:uint;
	
	public function ActionCounter() {	
	}
	
	public function get nextCount():uint {
		return ++_currentCount;
	}
	
}